home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{5A65A9C0-089F-11D2-88AD-0000B45C4CF6}#1.0#0"; "EASYX.OCX"
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 3195
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 4680
- LinkTopic = "Form1"
- ScaleHeight = 3195
- ScaleWidth = 4680
- StartUpPosition = 3 'Windows Default
- Begin PROJECTEXLibCtl.EasyX EasyX1
- Left = 1320
- OleObjectBlob = "Form1.frx":0000
- Top = 840
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim SurfaceYellow As Long
- Dim SurfaceBlack As Long
- Dim SpriteYellow As Long
- Dim SpriteBlack As Long
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
- On Error GoTo Fejl
- If KeyCode = vbKeyEscape Then
- EasyX1.EndDirectX
- Unload Me
- End If
- If KeyCode = vbKeyA Then
- 'fill the surface first
- EasyX1.FillSurface 255, EX_PRIMARYSURFACE
- 'draw the sprite
- EasyX1.DrawSprite 100, 100, 100, 50, SpriteBlack
- 'flip it
- EasyX1.FlipSurface
- End If
- If KeyCode = vbKeyB Then
- 'fill the surface first
- EasyX1.FillSurface 255, EX_PRIMARYSURFACE
- 'draw the sprite
- EasyX1.DrawSprite 100, 100, 100, 50, SpriteYellow
- 'flip it
- EasyX1.FlipSurface
- End If
- If KeyCode = vbKeyC Then
- 'fill the surface first
- EasyX1.FillSurface 255, EX_PRIMARYSURFACE
- 'draw the sprite
- EasyX1.DrawSprite 100, 100, 100, 50, SpriteBlack
- EasyX1.DrawSprite 0, 0, 200, 100, SpriteYellow
- 'flip it
- EasyX1.FlipSurface
- End If
- If KeyCode = vbKeyD Then
- 'fill the surface first
- EasyX1.FillSurface 30, EX_PRIMARYSURFACE
- 'flip it
- EasyX1.FlipSurface
- End If
- Exit Sub
- Fejl:
- Debug.Print Err.Number & Err.Description
- Unload Me
- End Sub
- Private Sub Form_Load()
- Dim rt As Long
- Dim AppPath As String
- ''Do NOT forget this
- EasyX1.Window = Me.hWnd
- rt = EasyX1.InitDirectDraw(320, 200, 8)
- If rt <> EX_OK Then
- 'try a different format
- rt = EasyX1.InitDirectDraw(640, 480, 8)
- If rt <> EX_OK Then 'hmmm wrong again..try another
- rt = EasyX1.InitDirectDraw(800, 600, 8)
-
- If rt <> EX_OK Then 'that
- s it..no more..
- MsgBox "Direct draw could not initializee", vbOKOnly, "Failure"
- Exit Sub
- End If
- End If
- End If
- 'load the surfaces
- AppPath = App.Path & "\"
- SurfaceYellow = EasyX1.LoadBitmapFile(AppPath & "easyx.bmp", -1)
- If SurfaceYellow < 0 Then
- MsgBox "Could not load graphics" & vbCrLf & "Make sure that the graphic files are there", vbOKOnly, "Failure"
- EasyX1.EndDirectX
- Unload Me
- Exit Sub
- End If
- SurfaceBlack = EasyX1.LoadBitmapFile(AppPath & "easyx1.bmp", -1)
- If SurfaceBlack < 0 Then
- MsgBox "Could not load graphics" & vbCrLf & "Make sure that the graphic files are there", vbOKOnly, "Failure"
- EasyX1.EndDirectX
- Unload Me
- Exit Sub
- End If
- 'make the sprites
- SpriteYellow = EasyX1.MakeSprite(0, 0, 100, 50, SurfaceYellow)
- SpriteBlack = EasyX1.MakeSprite(0, 0, 100, 50, SurfaceBlack)
- 'color the background black
- EasyX1.FillSurface 0, EX_PRIMARYSURFACE
- 'and flip the color to make it visible
- EasyX1.FlipSurface
- End Sub
-